package bairui.international.model.domain.jpa;

/**
 *
 * @see TB_Department 部门
 *
 */
public class TestData_TB_Department
{

	private final static org.apache.commons.text.RandomStringGenerator Generator = new org.apache.commons.text.RandomStringGenerator.Builder().withinRange(new char[][]{{'a','z'}, {'A','Z'}, {'0','9'}}).build();

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@org.springframework.transaction.annotation.Transactional(rollbackFor=java.lang.Throwable.class)
	public static TB_Department saveMust(
		org.springframework.context.ApplicationContext context
		
	){
		org.springframework.data.jpa.repository.JpaRepository repository = (org.springframework.data.jpa.repository.JpaRepository)context.getBean("repository_Department");
		return (TB_Department)repository.save(newMust(
				
			));
	}
	
	public static TB_Department newMust(
		
	){
		return new TB_Department(new TB_Department.MustProperties() {
			/** 角色名称 */
			@Override public String getRoleName(){
				return Generator.generate(0, 20);
			}
			/** 角色状态 */
			@Override public com.sh_lianjing.project.authority.model.status.State_Role getRoleState(){
				return com.sh_lianjing.project.authority.model.status.State_Role.Activated;
			}
			/** 名称 */
			@Override public String getName(){
				return Generator.generate(0, 20);
			}
		});
	}
	

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@org.springframework.transaction.annotation.Transactional(rollbackFor=java.lang.Throwable.class)
	public static TB_Department saveAll(
		org.springframework.context.ApplicationContext context,
		bairui.international.model.domain.jpa.TB_Department parent
	,bairui.international.model.domain.jpa.TB_Admin head
	){
		org.springframework.data.jpa.repository.JpaRepository repository = (org.springframework.data.jpa.repository.JpaRepository)context.getBean("repository_Department");
		return (TB_Department)repository.save(newAll(
				parent
				,head
			));
	}
	
	public static TB_Department newAll(
		bairui.international.model.domain.jpa.TB_Department parent
	,bairui.international.model.domain.jpa.TB_Admin head
	){
		return new TB_Department(
			new TB_Department.MustProperties() {
				/** 角色名称 */
				@Override public String getRoleName(){
					return Generator.generate(0, 20);
				}
				/** 角色状态 */
				@Override public com.sh_lianjing.project.authority.model.status.State_Role getRoleState(){
					return com.sh_lianjing.project.authority.model.status.State_Role.Activated;
				}
				/** 名称 */
				@Override public String getName(){
					return Generator.generate(0, 20);
				}
			},
			new TB_Department.OptionalSingleProperties() {
				/** 角色备注 */
				@Override public String getRoleComment(){
					return Generator.generate(0, 500);
				}
				/** 备注 */
				@Override public String getComment(){
					return Generator.generate(0, 500);
				}
				/** 详情 */
				@Override public String getDetails(){
					return Generator.generate(0, 20000);
				}
				/** 父 */
				@Override public bairui.international.model.domain.jpa.TB_Department getParent(){
					return parent;
				}
				/** 负责人 */
				@Override public bairui.international.model.domain.jpa.TB_Admin getHead(){
					return head;
				}
			}
		);
	}
	

}
